//
//  InvitationRegisterVC.m
//  WanCaiC8
//
//  Created by tangang on 2018/1/19.
//  Copyright © 2018年 tangang. All rights reserved.
//

#import "InvitationRegisterVC.h"
#import "RewardRulesVC.h"
#import "MyVM.h"
@interface InvitationRegisterVC ()

@end

@implementation InvitationRegisterVC{
    QXLable *labPeople;
    QXLable *labMoney;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title=@"邀请注册";
    [self createUI];
    self.view.backgroundColor=[UIColor whiteColor];
}


- (void)onclickShare:(UIButton *)sender{
    [[MyVM manage] getInvitationRegWithSuccess:^(id returnValue) {
        
        [ShareHelper shareWithInvitationRegister:sender.tag andDict:returnValue];
        
    } andFail:^(NSString *errorMessage, NSError *error) {
        
    }];
    
    
}

- (void)createUI{
    
    UIView *bgView = [[UIView alloc] init];
    bgView.backgroundColor = NAVCOLOR;
    [self.view addSubview:bgView];
    [bgView mas_makeConstraints:^(MASConstraintMaker *make) {
    make.left.right.top.equalTo(self.view);
       make.height.mas_equalTo(300);
    }];
    
    UIImageView *icon=[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"YCWLaunch"]];
    
    icon.layer.cornerRadius =10;
    icon.layer.masksToBounds = YES;
    [bgView addSubview:icon];
    [icon mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(bgView).offset(80);
        make.centerX.equalTo(bgView);
        make.size.mas_equalTo(CGSizeMake(70, 70));
    }];
    
    
    UILabel *label = [UILabel tg_labelWithText:@"盈彩网" fontSize:15 color:[UIColor whiteColor]];
    [bgView addSubview:label];
    
    [label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(icon);
        make.top.equalTo(icon.mas_bottom).offset(10);
    }];

    
//    UIImageView *bgImageV=[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"Invitation_BG"]];
//    [self.view addSubview:bgImageV];
//    [bgImageV mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.left.right.top.equalTo(self.view);
//        make.height.mas_equalTo(@(bgImageV.image.size.height/(bgImageV.image.size.width/SCREEN_WIDTH)));
//    }];
    
    UIView *shareView=[[UIView alloc]init];
    shareView.backgroundColor=[UIColor whiteColor];
    shareView.layer.cornerRadius=6.0;
    shareView.layer.shadowColor=DEFAULTTEXTBLACKCOLOR.CGColor;
    shareView.layer.shadowRadius=6.0;
    shareView.layer.shadowOpacity=.6f;
    [self.view addSubview:shareView];
    [shareView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(bgView.mas_bottom).with.offset(-60);
        make.left.equalTo(self.view).with.offset(13);
        make.right.equalTo(self.view).with.offset(-13);
        make.height.mas_equalTo(@(real_size(100)));
    }];
    
    UIButton *btnWechat=[[UIButton alloc]init];
    [btnWechat setTitle:@"微信好友" forState:UIControlStateNormal];
    [btnWechat.titleLabel setFont:[UIFont systemFontOfSize:13]];
    [btnWechat addTarget:self action:@selector(onclickShare:) forControlEvents:UIControlEventTouchUpInside];
    btnWechat.tag=0;
    [btnWechat setTitleColor:DEFAULTTEXTBLACKCOLOR forState:UIControlStateNormal];
    [btnWechat verticalTopImageAndTitle:15 andImage:[UIImage imageNamed:@"share_wechat"]];
    [shareView addSubview:btnWechat];
    [btnWechat mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(shareView);
        make.width.equalTo(shareView).with.multipliedBy(1/3.0);
        make.centerY.equalTo(shareView);
        make.bottom.equalTo(shareView).with.offset(-10);
    }];
    
    UIButton *btnCircleFriends=[[UIButton alloc]init];
    [btnCircleFriends setTitle:@"朋友圈" forState:UIControlStateNormal];
    [btnCircleFriends.titleLabel setFont:[UIFont systemFontOfSize:13]];
    [btnCircleFriends setTitleColor:DEFAULTTEXTBLACKCOLOR forState:UIControlStateNormal];
    [btnCircleFriends addTarget:self action:@selector(onclickShare:) forControlEvents:UIControlEventTouchUpInside];
    btnCircleFriends.tag=1;
    [btnCircleFriends verticalTopImageAndTitle:15 andImage:[UIImage imageNamed:@"CircleFriends"]];
    [shareView addSubview:btnCircleFriends];
    [btnCircleFriends mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(shareView);
        make.width.equalTo(shareView).with.multipliedBy(1/3.0);
        make.centerY.equalTo(shareView);
        make.bottom.equalTo(shareView).with.offset(-10);
    }];
    
    UIButton *btnQQ=[[UIButton alloc]init];
    [btnQQ setTitle:@"QQ好友" forState:UIControlStateNormal];
    [btnQQ.titleLabel setFont:[UIFont systemFontOfSize:13]];
    [btnQQ setTitleColor:DEFAULTTEXTBLACKCOLOR forState:UIControlStateNormal];
    [btnQQ addTarget:self action:@selector(onclickShare:) forControlEvents:UIControlEventTouchUpInside];
    btnQQ.tag=2;
    [btnQQ verticalTopImageAndTitle:15 andImage:[UIImage imageNamed:@"share_qq"]];
    [shareView addSubview:btnQQ];
    [btnQQ mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(shareView);
        make.bottom.equalTo(shareView).with.offset(-10);
        make.width.equalTo(shareView).with.multipliedBy(1/3.0);
        make.centerY.equalTo(shareView);
    }];
}

- (void)onclickRules{
    RewardRulesVC *vc=[[RewardRulesVC alloc]init];
    [self.navigationController pushViewController:vc animated:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
